#include "head.h"
void *func(void *p){
    printf("pthread start! \n");
    status_t *status = (status_t *)p;
    while(1){
        pthread_mutex_lock(&status->lock);
        while(status->q.size <= 0 && status->end_flag == 0){
            pthread_cond_wait(&status->cond,&status->lock);
        }
        if(status->end_flag == 1){
            pthread_mutex_unlock(&status->lock);
            printf("子线程退出\n");
            pthread_exit(NULL);
        }
        int net_fd = dequeue(&status->q);
        pthread_mutex_unlock(&status->lock);
        
        doWork(net_fd);

        close(net_fd);
    }
}
